package com.yilin.medical.fragment;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

import com.yilin.medical.R;
import com.yilin.medical.activity.BingLiTaoLunDetailsActivity;
import com.yilin.medical.adapter.ZhongLiuAdapter;
import com.yilin.medical.model.ZhongLiuBean;
/**
 * 肿瘤
 * @author lijianqun
 *
 */
public class ZhongLiuFragment extends Fragment implements OnItemClickListener {
	private Context context;
	private View mView;
	private ListView mListViewZhongLiu;
	private List<ZhongLiuBean> mList;

	@Override
	public void onAttach(Activity activity) {
		super.onAttach(activity);
		context = activity;
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		mView = View.inflate(context, R.layout.fragment_zhongliu, null);
		initview();
		registerLstener();
		initData();
		fillData();
		return mView;
	}

	private void registerLstener() {
		mListViewZhongLiu.setOnItemClickListener(this);
	}

	private void initData() {

	}

	private void fillData() {
		mList = new ArrayList<ZhongLiuBean>();
		for (int i = 0; i < 20; i++) {
			mList.add(new ZhongLiuBean());
		}
		ZhongLiuAdapter mAdapter = new ZhongLiuAdapter(context, mList);
		mListViewZhongLiu.setAdapter(mAdapter);
	}

	private void initview() {
		mListViewZhongLiu = (ListView) mView.findViewById(R.id.lv_zhongliu);
	}

	@Override
	public void onItemClick(AdapterView<?> parent, View view, int position,
			long id) {
		Intent intent = new Intent(context,BingLiTaoLunDetailsActivity.class);
		startActivity(intent);
		
	}
}
